from pymongo import MongoClient

stock_url = 'mongodb://stock:123456@10.11.1.201:27017/stock?authMechanism=SCRAM-SHA-1'
stock_conn = MongoClient(stock_url, connect=False)
stock_db = stock_conn['stock']

history_transaction_data_url = 'mongodb://stock:123456@10.11.1.201:27017/history_transaction_data?authMechanism=SCRAM-SHA-1'
history_transaction_data_conn = MongoClient(history_transaction_data_url, connect=False)
history_transaction_data_db = history_transaction_data_conn['history_transaction_data']


def get_stock_db():
    return stock_db


def get_history_transaction_data_db():
    return history_transaction_data_db


if __name__ == '__main__':
    db = get_history_transaction_data_db()
    db['test'].insert_one({"aaa": 1, "bbb": 2})
    data = db['test'].find_one({"aaa": 1})
    print(data)
